<?php


namespace App\Transformers\System;


use App\Models\SystemAttachment;
use League\Fractal\TransformerAbstract;

class SystemAttachmentTransformer extends TransformerAbstract
{
    public function transform(SystemAttachment $data)
    {
        return [
            'id' => $data->id,
            'user_id' => $data->user_id ?? '',
            'name' => $data->name ?? '',
            'category_id' => $data->category_id ?? '',
            'att_dir' => $data->att_dir ?? '',
            'satt_dir' => $data->satt_dir ?? '',
            'size' => $data->size ?? '',
            'type' => $data->type ?? '',
            'upload_type' => $data->upload_type ?? '',
            'hash' => $data->hash ?? '',
            'module_type' => $data->module_type ?? '',
            'original_name' => $data->original_name ?? '',
            'created_at' => $data->created_at ? $data->created_at->format("Y-m-d H:i:s") : '',
            'updated_at' => $data->updated_at ? $data->updated_at->format("Y-m-d H:i:s") : '',
        ];
    }
}
